package com.zzf.concurrent.example.single;

import lombok.extern.slf4j.Slf4j;

/**
 * @author GaoFeng2017
 * @date 2019/8/12 19:15
 */
@Slf4j
public class EnumSingleBean {

    private enum SingleBeanEnum {

        /** */
        SINGLE_BEAN_ENUM();

        private EnumSingleBean singleBean;

        SingleBeanEnum() {
            log.info("枚举构造被调用");
            this.singleBean = new EnumSingleBean();
        }

        public EnumSingleBean getSingleBean() {
            return singleBean;
        }

    }

    private EnumSingleBean() {
        // log.info("单例构造被调用");
    }

    public static EnumSingleBean getInstance() {
        log.info("获取单例bean");
        return SingleBeanEnum.SINGLE_BEAN_ENUM.getSingleBean();
    }

}
